<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>模型管理</title>
<link rel="stylesheet" href="css/buttons.css" type="text/css"/>
<link rel="stylesheet" href="css/font-awesome.min.css" type="text/css"/>
<style>
	table{border-collapse:collapse;} 
	table,th,td{border:1px solid #ccc;padding:5px 10px;}
	.button{margin-bottom: 20px;}
	i{color: black;}
	i:hover{
     color: rgba(0, 102, 153, 1);
   }
</style>
</head>
<body>
<div id="top">
</div>
<h2>模型列表</h2>
<hr>
<a href="javascript: AJAX.POST('/models/gotoNewModel')" class="button button-rounded button-small"><i class="fa fa-plus" title="新建"></i></a>
<table id="model-list">
    <tr>
        <td>模型编号</td>
        <td>模型名称</td>
        <td>版本</td>
        <td>创建时间</td>
        <td>操作</td>
    </tr>
    <script id="models" type="text/html">
        <tr>
            <td>模型编号</td>
            <td>模型名称</td>
            <td>版本</td>
            <td>创建时间</td>
            <td>操作</td>
        </tr>
        {{each rows.list}}
        <tr>
            <td>{{$value.id}}</td>
            <td>{{$value.name}}</td>
            <td>{{$value.version}}</td>
            <td>{{$value.createTime}}</td>
            <td>
				<a href="javascript: AJAX.DELETE('/models/{{$value.id}}')"><i class="fa fa-trash-o" aria-hidden="true" title="删除"></i></a>
				<a href="/modeler.html?modelId={{$value.id}}"><i class="fa fa-pencil-square-o" aria-hidden="true" title="编辑"></i></a>
				<a href="/modeler_w.html?modelId={{$value.id}}"><i class="fa fa-gavel" aria-hidden="true" title="审核"></i></a>
				<a href="javascript: AJAX.POST('/models/{{$value.id}}/deployment')"><i class="fa fa-paper-plane-o" aria-hidden="true" title="发布"></i></a>
				<a href="/repository/process-definitions/export/{{$value.id}}"><i class="fa fa-download" aria-hidden="true" title="下载XML"></i></a>
            </td>
        </tr>
        {{/each}}
    </script>
</table>
<hr>
<h2>部署列表</h2>
<hr>
<table id="deployment-list">
    <tr>
        <td>编号</td>
        <td>名称</td>
        <td>部署时间</td>
        <td>操作</td>
    </tr>
    <script id="deployments" type="text/html">
        <tr>
            <td>编号</td>
            <td>名称</td>
            <td>部署时间</td>
            <td>操作</td>
        </tr>
    {{each rows.list}}
    <tr>
        <td>{{$value.id}}</td>
        <td>{{$value.name}}</td>
        <td>{{$value.deploymentTime}}</td>
        <td><a href="javascript: AJAX.DELETE('/deployments/{{$value.id}}')"><i class="fa fa-trash-o" aria-hidden="true" title="删除"></i></a></td>
    </tr>
    {{/each}}
    </script>
</table>
<script src="/lib/js/jquery-1.10.2.min.js"></script>
<script src="/lib/js/jquery.cookie.js"></script>
<script src="/js/ajax-util.js"></script>
<script src="/lib/js/template.js"></script>

<script>
$(function() {
    AJAX.GET("/models", null
            , function (result) {
                var html = template("models", result);
                $("#model-list").html(html);
            });

    AJAX.GET("/deployments", null
            , function (result) {
                var html = template("deployments", result);
                $("#deployment-list").html(html);
            });
})
</script>
</body>
</html>
